<html>
<head><meta charset="utf-8"><title>build-script-rustflags · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html">build-script-rustflags</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243192447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-script-rustflags/near/243192447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html#243192447">(Jun 18 2021 at 18:04)</a>:</h4>
<p>Hi folks! I recently came across a <a href="https://github.com/dtolnay/anyhow/issues/156">bug in anyhow</a> whose root cause is that it does  "test compile" to see whether it can make use of some nightly features, but that test compile does not take into account Cargo configuration like <code>[build] rustflags = </code>. Looking through the <a href="https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts">environment variables Cargo sets for build scripts</a> it doesn't appear that things like the rustc wrapper or the final rustflags is actually passed to the build script — is that intentional?</p>



<a name="243193762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-script-rustflags/near/243193762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html#243193762">(Jun 18 2021 at 18:19)</a>:</h4>
<p>I also have this problem for <code>autocfg</code>, which I would really love to solve</p>



<a name="243193809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-script-rustflags/near/243193809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html#243193809">(Jun 18 2021 at 18:19)</a>:</h4>
<p><a href="https://github.com/cuviper/autocfg/issues/15">https://github.com/cuviper/autocfg/issues/15</a><br>
<a href="https://github.com/cuviper/autocfg/issues/34">https://github.com/cuviper/autocfg/issues/34</a></p>



<a name="243195188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-script-rustflags/near/243195188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html#243195188">(Jun 18 2021 at 18:35)</a>:</h4>
<p>I went ahead and filed <a href="https://github.com/rust-lang/cargo/issues/9600">https://github.com/rust-lang/cargo/issues/9600</a> — will see if I can submit a PR for that too.</p>



<a name="243196540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-script-rustflags/near/243196540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-script-rustflags.html#243196540">(Jun 18 2021 at 18:50)</a>:</h4>
<p><a href="https://github.com/rust-lang/cargo/pull/9601">https://github.com/rust-lang/cargo/pull/9601</a> has a fix. Going to also add a test for it though <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>